package com.bookstore.Service.impl;

import com.bookstore.Domain.Announcement;
import com.bookstore.Domain.Shopping;
import com.bookstore.Service.AnnouncementService;
import com.bookstore.mapper.AnnouncementMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 未来
 */
@Service
public class AnnouncementServiceImpl implements AnnouncementService {

    private final AnnouncementMapper announcementMapper;

    @Autowired
    public AnnouncementServiceImpl(AnnouncementMapper announcementMapper) {
        this.announcementMapper = announcementMapper;
    }


    @Override
    public List<Announcement> findAll() {
        return announcementMapper.selectList(null);
    }

    @Override
    public boolean saveShopping(Announcement announcement) {
        return announcementMapper.insert(announcement)>0;
    }

    @Override
    public boolean deleteAnnouncement(int id) {
        return announcementMapper.deleteById(id)>0;
    }
}
